/******************************************************************************
             Copyright (c) 1999 Unigraphics Solutions, Inc.
                       Unpublished - All Rights Reserved
   This Program was created by Northwestern Polytechnical University in 2007.
*******************************************************************************/

#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_curve.h>
#include <uf_obj.h>

#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
  if (irc)
  {
     char    messg[133];
     printf("%s, line %d:  %s\n", file, line, call);
     (UF_get_fail_message(irc, messg)) ?
       printf("    returned a %d\n", irc) :
       printf("    returned error %d:  %s\n", irc, messg);
  }
  return(irc);
}
static void do_ugopen_api(void)
{
	double origin_point1[3]={1,1,1};
	double plane_normal1[3]={0,0,1};
	double origin_point2[3]={2,3,4};
	double plane_normal2[3]={0,1,0};
	double origin_point3[3]={7,8,9};
	double plane_normal3[3]={1,0,0};
	tag_t plane_tag;
	int num_objects;
	tag_t object_id[10];
	int *statuses;
	UF_CALL(UF_MODL_create_plane(origin_point1,plane_normal1,&plane_tag));
	UF_CALL(UF_MODL_create_plane(origin_point2,plane_normal2,&plane_tag));
	UF_CALL(UF_MODL_create_plane(origin_point3,plane_normal3,&plane_tag));
	UF_CALL(UF_OBJ_delete_array_of_objects (num_objects,object_id,&statuses));
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int param_len)
{
  if (!UF_CALL(UF_initialize()))
  {
    do_ugopen_api();
    UF_CALL(UF_terminate());
  }
}
int ufusr_ask_unload(void)
{
  return (UF_UNLOAD_IMMEDIATELY);
}


